/**
 * @file mapping_factory.cc
 * @author DustinKsi (dustinksi@126.com)
 * @brief
 * @version 0.1
 * @date 2019-12-12
 *
 * @copyright Copyright (c) 2019
 *
 */

#include "venus/mapping/mapping_factory.h"

#include "venus/mapping/full_graph_mapping/full_graph_mapping.h"
#include "venus/mapping/carto_mapping/carto_mapping.h"
#include "venus/mapping/dustin_mapping/dustin_mapping.h"

namespace VEnus {
namespace Mapping {

void MappingFactory::RegisterMappingFactory() {
  Register(VEnus::Mapping::FullGraph, []() -> AbstractMapping * { return new FullGraphMapping(); });
  Register(VEnus::Mapping::Carto, []() -> AbstractMapping * { return new CartoMapping(); });
  Register(VEnus::Mapping::Dustin, []() -> AbstractMapping * { return new DustinMapping(); });
}

std::unique_ptr<AbstractMapping> MappingFactory::CreateMapping(const MappingOptions &options) {
  auto abstract_factory = CreateObject(options.brand());
  if (!abstract_factory) {
    D_ERROR << "MappingFactory failed to create instance";
  } else {
    abstract_factory->SetMappingOptions(options);
    //  CLASS_LOG(MappingFactory) << " successfully created instance";
  }
  return abstract_factory;
}
}
}